package com.stars.easyms.logger.support.logback.compatibility;

import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.Appender;
import ch.qos.logback.core.util.COWArrayList;

import java.util.List;

/**
 * <p>className: CowArrayListHandler</p>
 * <p>description: COWArrsyList类的处理类</p>
 *
 * @author guoguifang
 * @date 2019-12-25 13:56
 * @since 1.5.0
 */
final class CowArrayListHandler {

    static void addIfAbsent(List<Appender<ILoggingEvent>> appenderList, Appender<ILoggingEvent> newAppender) {
        ((COWArrayList<Appender<ILoggingEvent>>) appenderList).addIfAbsent(newAppender);
    }

    static Appender<ILoggingEvent>[] asTypedArray(List<Appender<ILoggingEvent>> appenderList) {
        return ((COWArrayList<Appender<ILoggingEvent>>) appenderList).asTypedArray();
    }
}